Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 8 - Tag Objects / About Tag Objects


Tag Types

Tag objects have types in order to identify their purpose. For example, if you want to identify a circle that is approximated by a QuickDraw GX path shape, you might attach to it a tag of type 'CRCL'. Then, whenever your application scales a path shape, it can first check to see if there is a tag object of type 'CRCL' attached to that shape. If there is, your application can make sure that the scaling preserves the circularity of the result. If your application has its own circle-drawing function, it can call that function instead of calling GXDrawShape to draw the circle.

The creator of a tag object can give it any 4-byte type value, although it is customary to make it a value that can be represented with four 1-byte ASCII characters. Apple Computer, Inc., reserves all tag types that can be represented with lowercase characters only, such as 'dave'. There are no other restrictions, except that a tag type cannot be 0. If you intend your tag type to be exportable (usable by other applications), you can be certain that it will not conflict with other applications' tag types if you use your application's creator type, as registered with Macintosh Developer Technical Support, as your tag type.

Note
A four-character tag type is not portable. On systems other than the Macintosh, the tag type may print or display quite differently, and one with the same appearance may have a very different numeric value. For maximum portability, it is best to define tag types with hexadecimal values, such as
#define daveTag 0x44415645            /* 'DAVE' */

In this way, the tag type daveTag will be correct regardless of the architecture of the machine it is defined on.
Some tag types have already been defined for specific purposes. QuickDraw GX uses tag objects for printing synonyms, which include data such as PostScript commands that replace the QuickDraw GX drawing commands for printing on PostScript printers. QuickDraw GX also uses tag objects to list fonts and individual glyphs used by flattened shapes. There are several currently defined tag types for printing synonyms, one for flattened fonts and glyphs, plus other tag types for various other purposes. Table 8-1 lists some of the currently defined tag types.
Table 8-1 Defined tag types for tag objects
Tag typeConstantExplanation
'flst'gxFlatFontListItemTagTag object contains a list of fonts used by the associated object (a flattened shape).
'bfil'gxBitmapFileAliasTagTypeTag object contains an alias record specifying the file that holds the pixel image for the associated bitmap
shape object.
'post'gxPostScriptTagTag object contains PostScript instructions replacing the
information in the associated
object.
'psct'gxPostControlTagTag object contains a control flag plus font and encoding information for a PostScript printer.
'sdsh'gxDashSynonymTagTag object contains dash information to be used by the PostScript setdash operator.
'lcap'gxLineCapSynonymTagTag object contains cap information
to be used by the PostScript setlinecap operator.
'half'gxFormathalftoneTagTag object contains halftone information to be used by a
PostScript printer.
'ptrn'gxPatternSynonymTagTag object contains pattern information to be used by vector devices.
'cubx'gxCubicSynonymTagTag object contains a cubic Bézier representation of a curve or path.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996